package com.ruoyi.web.controller.laiqianba.applet;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.applet.service.IOverdueRecordInfoService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.db.domain.OverdueRecordInfo;
import com.ruoyi.web.wrapper.OverdueRecordInfoWrapper;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 律所Controller
 * 
 * @author ruoyi
 * @date 2025-10-23
 */
@RestController
@RequestMapping("/applet/overdueInfo")
public class OverdueRecordInfoController extends BaseController
{
    @Autowired
    private IOverdueRecordInfoService overdueRecordInfoService;

    /**
     * 查询律所列表
     */
    @PreAuthorize("@ss.hasPermi('applet:overdueInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(OverdueRecordInfo overdueRecordInfo)
    {
        startPage();
        List<Map<String, Object>> list = overdueRecordInfoService.selectOverdueRecordInfoMapList(overdueRecordInfo);
        list = new OverdueRecordInfoWrapper(list).wrap();
        return getDataTable(list);
    }

    /**
     * 导出律所列表
     */
    @PreAuthorize("@ss.hasPermi('applet:overdueInfo:export')")
    @Log(title = "律所", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OverdueRecordInfo overdueRecordInfo)
    {
        List<OverdueRecordInfo> list = overdueRecordInfoService.selectOverdueRecordInfoList(overdueRecordInfo);
        ExcelUtil<OverdueRecordInfo> util = new ExcelUtil<OverdueRecordInfo>(OverdueRecordInfo.class);
        util.exportExcel(response, list, "律所数据");
    }

    /**
     * 获取律所详细信息
     */
    @PreAuthorize("@ss.hasPermi('applet:overdueInfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(overdueRecordInfoService.selectOverdueRecordInfoById(id));
    }

    /**
     * 新增律所
     */
    @PreAuthorize("@ss.hasPermi('applet:overdueInfo:add')")
    @Log(title = "律所", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OverdueRecordInfo overdueRecordInfo)
    {
        return toAjax(overdueRecordInfoService.insertOverdueRecordInfo(overdueRecordInfo));
    }

    /**
     * 修改律所
     */
    @PreAuthorize("@ss.hasPermi('applet:overdueInfo:edit')")
    @Log(title = "律所", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OverdueRecordInfo overdueRecordInfo)
    {
        return toAjax(overdueRecordInfoService.updateOverdueRecordInfo(overdueRecordInfo));
    }

    /**
     * 删除律所
     */
    @PreAuthorize("@ss.hasPermi('applet:overdueInfo:remove')")
    @Log(title = "律所", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(overdueRecordInfoService.deleteOverdueRecordInfoByIds(ids));
    }
}
